From b9ae83b6e2a50a21a6fe16273218e3403d053fc7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 22 Jun 2010 16:00:08 +0100 Subject: [PATCH] python/xc: do not crash xend if /proc/xen/privcmd cannot be opened If /proc/xen/privcmd cannot be opened, start xend occurs Segmentation fault. Add check to fix it. Signed-off-by: Yu Zhiguo --- tools/python/xen/lowlevel/xc/xc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index a7286c4e85..13704249b5 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -72,7 +72,8 @@ static PyObject *pyxc_error_to_exception(xc_interface *xch) else pyerr = Py_BuildValue("(is)", err->code, desc); - xc_clear_last_error(xch); + if (xch) + xc_clear_last_error(xch); if ( pyerr != NULL ) { -- 2.30.2